//*******************************************************************
//  Car.java     Author: Tang Caiming
//  关于汽车信息的类.
//*******************************************************************

public class Car
{
   private String manufacturer; // 汽车厂商名称
   private String type; // 汽车型号
   private int date; // 出厂年份
   private boolean antique;
 
   // 构造方法
   public Car(){}
   public Car(String manufacturer, String type, int date)
   {
      this.manufacturer = manufacturer;
      this.type = type;
      this.date = date;
   }

   // 定义设置和获取汽车厂商名称方法
   public void setManufacturer(String manufacturer)
   {
      this.manufacturer = manufacturer;
   }

   public String getManufacturer()
   {
      return this.manufacturer;
   }
  
   // 定义设置和获取汽车型号方法
   public void setType(String type)
   {
      this.type = type;
   }
   
   public String getType()
   {
      return this.type;
   }

   // 定义设置和获取汽车出厂年份方法
   public void setDate(int date)
   {
      this.date = date;
   }
  
   public int getDate()
   {
      return this.date;
   }
   
   // 创建方法，判断其是否为古董车
   public boolean isAntique()
   {
      if (2018-date > 45)
         antique = true;
      else
         antique = false;
      return antique;
   }

   // 定义方法，输出字符串
   public String toString()
   {
      return "汽车厂商名称: " + manufacturer + "\n"+
             "汽车型号: " + type + "\n" +
             "汽车出场年份: " + date + "\n" +
             "是否是古董车: " + isAntique();
   }
}
